package org.springframework.boot.tests.hibernate52.mytest.messagesource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Locale;

@Component
public class MyMessageSourceTest {
	@Autowired
	private MessageSource MessageSource;

	@PostConstruct
	public void init() {
		System.out.println("自定义国际化测试>>>>>>>");
		String message = MessageSource.getMessage("7", new Object[]{}, Locale.SIMPLIFIED_CHINESE);
		System.out.println("输出中文>>>>>>>" + message);
		message = MessageSource.getMessage("7", new Object[]{}, Locale.US);
		System.out.println("输出英文>>>>>>>" + message);
	}
}
